surface: Fix the fallback move-to-rect implementation
authorMatthias Clasen <mclasen@redhat.com>
Wed, 22 May 2019 23:47:59 +0000 (23:47 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 28 May 2019 20:25:17 +0000 (20:25 +0000)
On X11, the final and flipped rects were reporting
global coordinates. This was showing up as misplaced
popover beaks.

gdk/gdksurface.c

index c48a3b09590c0a518fe13da64172016498b39c7a..16c3ed5e60dea9cba73a17c1bacde8febfe41bad 100644 (file)
@@ -271,6 +271,7 @@ gdk_surface_real_move_to_rect (GdkSurface         *surface,
   GdkRectangle final_rect;
   gboolean flipped_x;
   gboolean flipped_y;
+  int x, y;
 
   /* This implementation only works for backends that
    * can provide root coordinates via get_root_coords.
@@ -373,6 +374,12 @@ gdk_surface_real_move_to_rect (GdkSurface         *surface,
   else
     gdk_surface_move (surface, final_rect.x, final_rect.y);
 
+  gdk_surface_get_origin (toplevel, &x, &y);
+  final_rect.x -= x;
+  final_rect.y -= y;
+  flipped_rect.x -= x;
+  flipped_rect.y -= y;
+
   g_signal_emit_by_name (surface,
                          "moved-to-rect",
                          &flipped_rect,